package simple3D.materials 
{
	import flash.display.Graphics;
	/**
	 * ...
	 * @author Dmitriy Gaiduk
	 */
	public class ColorMaterial extends Material3D
	{
		private var _color:uint;
		private var _alpha:Number;
		
		public function ColorMaterial(color:uint) 
		{
				_color = color;
				_alpha = 1;
		}
		
		override public function drawTriangles(gr:Graphics, vertices:Vector.<Number>, indices:Vector.<int>, 
										uvt:Vector.<Number>, triangleCulling:String):void 
		{
			gr.beginFill(_color, _alpha);
			gr.lineStyle(1, 0x000000);
			gr.drawTriangles(vertices, indices, null, triangleCulling);
			gr.endFill();
		}
		
		/*override public function beginFill(gr:Graphics):void 
		{
			gr.beginFill(_color, _alpha);
			gr.lineStyle(1, 0x000000);
		}*/
		
		public function get color():uint 
		{
			return _color;
		}
		
		public function set color(value:uint):void 
		{
			_color = value;
		}
		
		public function get alpha():Number 
		{
			return _alpha;
		}
		
		public function set alpha(value:Number):void 
		{
			_alpha = value;
		}
	}

}